import request from '@/utils/request';
import bodyParse from '@/utils/bodyParse';



//部门树
export async function department(params) {
  return request('/wbn-api/department' + bodyParse(params));
}
//部门下人员列表
export async function departmember(params) {
  return request('/wbn-api/department/' + params.id);
}
//创建部门树
export async function adddepartment(params) {
  return request('/wbn-api/department', {
    method: 'POST',
    data: params,
  });
}

//更新部门树
export async function editdepartment(params) {
  return request('/wbn-api/department/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除部门树
export async function deletedepartment(params) {
  return request('/wbn-api/department/' + params, {
    method: 'DELETE',
  });
}

//收款方式列表
export async function payment(params) {
  return request('/wbn-api/payment' + bodyParse(params));
}

//创建收款方式
export async function addpayment(params) {
  return request('/wbn-api/payment', {
    method: 'POST',
    data: params,
  });
}

//更新收款方式
export async function editpayment(params) {
  return request('/wbn-api/payment/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除收款方式
export async function deletepayment(params) {
  return request('/wbn-api/payment/' + params, {
    method: 'DELETE',
  });
}


//启用or禁用用户
export async function setenable(params) {
  return request('/wbn-api/user/set_enable', {
    method: 'PUT',
    data: params,
  });
}


//收款周期列表
export async function payment_cycle(params) {
  return request('/wbn-api/payment_cycle' + bodyParse(params));
}

//创建收款周期
export async function addpayment_cycle(params) {
  return request('/wbn-api/payment_cycle', {
    method: 'POST',
    data: params,
  });
}

//更新收款周期
export async function editpayment_cycle(params) {
  return request('/wbn-api/payment_cycle/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除收款周期
export async function deletepayment_cycle(params) {
  return request('/wbn-api/payment_cycle/' + params, {
    method: 'DELETE',
  });
}


//客户类型列表
export async function classify(params) {
  return request('/wbn-api/classify' + bodyParse(params));
}
//客户id查询
export async function classifydetail(params) {
  if (!params.classify_id) {
    return {}
  }
  return request('/wbn-api/classify/' + params.classify_id);
}


//创建客户类型
export async function addclassify(params) {
  return request('/wbn-api/classify', {
    method: 'POST',
    data: params,
  });
}

//更新客户类型
export async function editclassify(params) {
  return request('/wbn-api/classify/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除客户类型
export async function deleteclassify(params) {
  return request('/wbn-api/classify/' + params, {
    method: 'DELETE',
  });
}

//省
export async function province(params) {
  return request('/wbn-api/province' + bodyParse(params));
}
//市
export async function city(params) {
  return request('/wbn-api/city' + bodyParse(params));
}
//区
export async function district(params) {
  return request('/wbn-api/district' + bodyParse(params));
}

//区域列表
export async function area(params) {
  return request('/wbn-api/area' + bodyParse(params));
}

//创建区域
export async function addarea(params) {
  return request('/wbn-api/area', {
    method: 'POST',
    data: params,
  });
}

//更新区域
export async function editarea(params) {
  return request('/wbn-api/area/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除区域
export async function deletearea(params) {
  return request('/wbn-api/area/' + params, {
    method: 'DELETE',
  });
}

//团队列表
export async function group(params) {
  return request('/wbn-api/group' + bodyParse(params));
}

//创建团队
export async function addgroup(params) {
  return request('/wbn-api/group', {
    method: 'POST',
    data: params,
  });
}

//更新团队
export async function editgroup(params) {
  return request('/wbn-api/group/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除团队
export async function deletegroup(params) {
  return request('/wbn-api/group/' + params, {
    method: 'DELETE',
  });
}
//团队详情
export async function detailgroup(params) {
  return request('/wbn-api/group/' + params);
}

//更新角色
export async function rolemenu(params) {
  return request('/wbn-api/role/role_menu', {
    method: 'PUT',
    data: params,
  });
}

//角色详情
export async function menu(params) {
  return request('/wbn-api/menu');
}

export async function getrole(params) {
  return request('/wbn-api/role/' + params);
}

//角色列表
export async function role(params) {
  return request('/wbn-api/role' + bodyParse(params));
}

//创建角色
export async function addrole(params) {
  return request('/wbn-api/role', {
    method: 'POST',
    data: params,
  });
}

//更新角色
export async function editrole(params) {
  return request('/wbn-api/role/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除角色
export async function deleterole(params) {
  return request('/wbn-api/role/' + params, {
    method: 'DELETE',
  });
}

//查询用户
export async function search(params) {
  return request('/wbn-api/user/search' + bodyParse(params));
}

//用户列表
export async function user(params) {
  return request('/wbn-api/user' + bodyParse(params));
}

//用户列表
export async function basic_info(params) {
  return request('/wbn-api/role/basic_info' + bodyParse(params));
}

//用户详情
export async function userdetail(params) {
  return request('/wbn-api/user/' + params.id);
}

//创建用户
export async function adduser(params) {
  return request('/wbn-api/user', {
    method: 'POST',
    data: params,
  });
}

//更新用户
export async function edituser(params) {
  return request('/wbn-api/user/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除用户
export async function deleteuser(params) {
  return request('/wbn-api/user/' + params, {
    method: 'DELETE',
  });
}

//重置密码
export async function resetuser(params) {
  return request('/wbn-api/user/reset_password', {
    method: 'PUT',
    data: params,
  });
}
//修改密码
export async function editpwd(params) {
  return request('/wbn-api/user/edit_password', {
    method: 'PUT',
    data: params,
  });
}


//用户详情
export async function getuser(params) {
  return request('/wbn-api/user/' + params);
}


//门店列表
export async function store(params) {
  return request('/wbn-api/store' + bodyParse(params));
}

//创建门店
export async function addstore(params) {
  return request('/wbn-api/store', {
    method: 'POST',
    data: params,
  });
}

//更新门店
export async function editstore(params) {
  return request('/wbn-api/store/' + params.id, {
    method: 'PUT',
    data: params,
  });
}

//删除门店
export async function deletestore(params) {
  return request('/wbn-api/store/' + params, {
    method: 'DELETE',
  });
}



//当前用户信息
export async function queryCurrent() {
  return request('/wbn-api/user/info');
}

export async function queryNotices() {
  return request('/wbn-api/notices');
}
